package com.yanq.liancar.activity;

import android.app.Dialog;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.WrapperListAdapter;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.vondear.rxtool.RxActivityTool;
import com.vondear.rxtool.view.RxToast;
import com.yanq.liancar.R;
import com.yanq.liancar.activity.base.BaseToolbarActivity;
import com.yanq.liancar.adapter.DialogAdapter;
import com.yanq.liancar.adapter.DialogAdapter1;
import com.yanq.liancar.adapter.DialogAdapter2;
import com.yanq.liancar.adapter.ShopListAdapter;
import com.yanq.liancar.bean.DialogAdapterBean;
import com.yanq.liancar.bean.ShopListBean;
import com.yanq.liancar.url.Config;
import com.yanq.liancar.util.GlideImageLoader;
import com.yanq.liancar.util.LogUtils;
import com.yanq.liancar.util.Utils;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
import com.youth.banner.listener.OnBannerListener;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SmallCDelicateCarWashActivity extends BaseToolbarActivity {
    @BindView(R.id.iv_shaixuan)
    ImageView ivShaixuan;
    @BindView(R.id.iv_sousuo)
    ImageView ivSousuo;
    @BindView(R.id.iv_dingwei)
    ImageView ivDingwei;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;
    @BindView(R.id.banner)
    Banner banner;
    @BindView(R.id.ll_noshop)
    LinearLayout ll_noshop;
    private int page = 1;
    private boolean isClear = true;
    private int type, num;      //tyep:服务类别         num:筛选分类
    private List<ShopListBean.DataBean> shopListBeanList = new ArrayList<>();
    private ShopListAdapter adapter;
    private List<DialogAdapterBean.DataBean> mDialogAdapterBeanList = new ArrayList<>();
    private List<DialogAdapterBean.DataBean> juliList = new ArrayList<>();
    private List<DialogAdapterBean.DataBean> starList = new ArrayList<>();
    private DialogAdapter mDialogAdapter;
    private DialogAdapter1 mJuliAdapter;
    private DialogAdapter2 mStargAdapter;
    private List<Integer> imageUrl;

    //声明AMapLocationClient类对象
    private AMapLocationClient mLocationClient = null;
    //声明AMapLocationClientOption对象
    private AMapLocationClientOption mLocationOption = null;
    private double Latitude, Longitude;
    private String juli, quyu, pingfen;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_smallc_delicatecarwash);
        Utils.setStatusBar(this, true, false);
        ButterKnife.bind(this);
        Bundle bundle = getIntent().getExtras();
        type = bundle.getInt("type");
        if (type == 1) {
            mTvTitle.setText("精致洗车");
        } else if (type == 2) {
            mTvTitle.setText("特惠洗车");
        } else if (type == 3) {
            mTvTitle.setText("美容养护");
        } else if (type == 4) {
            mTvTitle.setText("保养维修");
        } else if (type == 5) {
            mTvTitle.setText("钣金喷漆");
        } else if (type == 6) {
            mTvTitle.setText("代办服务");
        } else if (type == 7) {
            mTvTitle.setText("全车打蜡");
        }else {

        }


        initRecyclerView();
        refreshListener();      //下拉刷新
        getLocation();
        setJuliData();
        setStarData();
        initBannerData();
    }

    @Override
    protected void onStart() {
        super.onStart();
        banner.startAutoPlay();
    }

    @Override
    protected void onStop() {
        super.onStop();
        banner.stopAutoPlay();
    }

    private void initBannerData() {
        imageUrl = new ArrayList<>();
        imageUrl.add(R.mipmap.banner1);
        imageUrl.add(R.mipmap.banner2);
        imageUrl.add(R.mipmap.banner3);
        imageUrl.add(R.mipmap.banner4);
        imageUrl.add(R.mipmap.banner5);
        imageUrl.add(R.mipmap.banner6);
        banner.setImageLoader(new GlideImageLoader())
                .setImages(imageUrl)//设置图片集合
                .setDelayTime(3000)//设置轮播时间
                .setBannerStyle(BannerConfig.CIRCLE_INDICATOR)//设置指示器位置（当banner模式中有指示器时）
                .setIndicatorGravity(BannerConfig.CENTER)
                .start();//banner设置方法全部调用完毕时最后调用
        banner.setOnBannerListener(new OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {
                //ToastUtils.showToast(SmallBGoodsDetailsActivity.this, "您点击了第" + (mBanners.get(position).type + 1) + "张照片");
            }
        });
    }

    private void getLocation() {
        mLocationClient = new AMapLocationClient(this);
        mLocationOption = new AMapLocationClientOption();
        //        /**
        //         * 设置定位场景，目前支持三种场景（签到、出行、运动，默认无场景）
        //         */
        //        mLocationOption.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn);
        //        if(null != mLocationClient){
        //            mLocationClient.setLocationOption(mLocationOption);
        //            //设置场景模式后最好调用一次stop，再调用start以保证场景模式生效
        //            mLocationClient.stopLocation();
        //            mLocationClient.startLocation();
        //        }

        mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
        //获取一次定位结果
        mLocationOption.setOnceLocation(true);
        //设置是否返回地址信息（默认返回地址信息）
        mLocationOption.setNeedAddress(true);
        //关闭缓存机制
        mLocationOption.setLocationCacheEnable(true);
        //给定位客户端对象设置定位参数
        mLocationClient.setLocationOption(mLocationOption);
        //启动定位
        mLocationClient.startLocation();
        mLocationClient.setLocationListener(new AMapLocationListener() {
            @Override
            public void onLocationChanged(AMapLocation aMapLocation) {
                if (aMapLocation != null) {
                    if (aMapLocation.getErrorCode() == 0) {
                        Latitude = aMapLocation.getLatitude();//获取纬度
                        Longitude = aMapLocation.getLongitude();//获取经度
                        LogUtils.e("经纬度====", Latitude + "=======" + Longitude);
                        if (type == 1) {
                            initOkGoAddService1();
                        } else {
                            initOkGoAddService();
                        }
                        getCity();
                    } else {
                        //定位失败时，可通过ErrCode（错误码）信息来确定失败的原因，errInfo是错误信息，详见错误码表。
                        Log.e("AmapError", "location Error, ErrCode:"
                                + aMapLocation.getErrorCode() + ", errInfo:"
                                + aMapLocation.getErrorInfo());
                    }
                }
            }
        });

    }

    @OnClick({R.id.iv_shaixuan, R.id.iv_sousuo, R.id.iv_dingwei})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_shaixuan:
                num=3;
                myDialog();
                break;
            case R.id.iv_sousuo:
                Bundle bundle1 = new Bundle();
                bundle1.putInt("type", type);
                RxActivityTool.skipActivity(this, SmallCSearchActivity.class, bundle1);
                break;
            case R.id.iv_dingwei:
                Bundle bundle = new Bundle();
                bundle.putInt("type", type);
                RxActivityTool.skipActivity(mContext, PeripheralShopActivity.class, bundle);
                break;
        }
    }

    private void initRecyclerView() {
        recyclerview.setNestedScrollingEnabled(false);
        recyclerview.setLayoutManager(new LinearLayoutManager(mContext));
        adapter = new ShopListAdapter(R.layout.item_fuwu, shopListBeanList);
        recyclerview.setAdapter(adapter);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Bundle bundle = new Bundle();
                bundle.putInt("shopId", shopListBeanList.get(position).getId());
                LogUtils.e("shopId", shopListBeanList.get(position).getId() + "");
                RxActivityTool.skipActivity(mContext, ShopDetailsActivity.class, bundle);
            }
        });
    }

    private void refreshListener() {
        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
                page = 1;
                isClear = true;
                //网络请求
                if (type == 1) {
                     if (num == 1) {
                        getShopByLang(juli);
                    } else if (num == 2) {
                        getShopByRemarkLevel(pingfen);
                    } else if (num ==3) {
                        getShopByRegion(quyu);
                    }else {
                        initOkGoAddService1();
                    }
                } else {
                    if (num == 1) {
                        getShopByLang(juli);
                    } else if (num == 2) {
                        getShopByRemarkLevel(pingfen);
                    } else if (num == 3) {
                        getShopByRegion(quyu);
                    }else {
                        initOkGoAddService();
                    }
                }
                refreshLayout.finishRefresh();
            }
        });

        refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
                isClear = false;
                page++;
                //网络请求
                if (type == 1) {
                    initOkGoAddService1();
                } else {
                    initOkGoAddService();
                }
                refreshLayout.finishLoadMore();
            }
        });
    }

    //查询普通店铺列表
    private void initOkGoAddService() {
        OkGo.<String>post(Config.s + "llc/shop/queryShopByType")
                .tag(this)
                .params("serviceType", type)
                .params("page", page)
                .params("num", 6)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        ShopListBean baseBean = gson.fromJson(response.body(), ShopListBean.class);
                        if (baseBean.isIsSuccess()) {
                            if (isClear) {
                                shopListBeanList.clear();
                            }
                            shopListBeanList.addAll(baseBean.getData());
                            if (shopListBeanList.size()<1){
                                ll_noshop.setVisibility(View.VISIBLE);
                            }else {
                                ll_noshop.setVisibility(View.GONE);
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }

    //查询精致洗车店铺列表
    private void initOkGoAddService1() {
        OkGo.<String>post(Config.s + "llc/fineCarServerController/queryShopForFCWServerList")
                .tag(this)
                .params("page", page)
                .params("num", 6)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        ShopListBean baseBean = gson.fromJson(response.body(), ShopListBean.class);
                        if (baseBean.isIsSuccess()) {
                            if (isClear) {
                                shopListBeanList.clear();
                            }
                            shopListBeanList.addAll(baseBean.getData());
                            if (shopListBeanList.size()<1){
                                ll_noshop.setVisibility(View.VISIBLE);
                            }else {
                                ll_noshop.setVisibility(View.GONE);
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }

    //查询市区
    private void getCity() {
        OkGo.<String>post(Config.s + "llc/areaController/queryCityRegion")
                .tag(this)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        DialogAdapterBean baseBean = gson.fromJson(response.body(), DialogAdapterBean.class);
                        if (baseBean.isIsSuccess()) {
                            mDialogAdapterBeanList.clear();
                            mDialogAdapterBeanList.addAll(baseBean.getData());
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (null != mLocationClient) {
            /**
             * 如果AMapLocationClient是在当前Activity实例化的，
             * 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
             */
            mLocationClient.onDestroy();
            mLocationClient = null;
            mLocationOption = null;
        }
    }

    private void myDialog() {
        final Dialog bottomDialog = new Dialog(this);
        View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_city, null);
        bottomDialog.setContentView(contentView);
        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) contentView.getLayoutParams();
        params.width = getResources().getDisplayMetrics().widthPixels;
        contentView.setLayoutParams(params);
        bottomDialog.getWindow().setGravity(Gravity.BOTTOM);
        bottomDialog.getWindow().setWindowAnimations(R.style.BottomDialog_Animation2);
        bottomDialog.setCanceledOnTouchOutside(true);
        bottomDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        bottomDialog.show();

        final RecyclerView dialog_recyclerView = bottomDialog.findViewById(R.id.recyclerview);
        dialog_recyclerView.setNestedScrollingEnabled(false);
        dialog_recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mDialogAdapter = new DialogAdapter(R.layout.item_dialog, mDialogAdapterBeanList);
        dialog_recyclerView.setAdapter(mDialogAdapter);

        mJuliAdapter = new DialogAdapter1(R.layout.item_dialog, juliList);
        mJuliAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                for (int i = 0; i < juliList.size(); i++) {
                    if (i == position) {
                        juliList.get(position).setIsCheck(true);
                    } else {
                        juliList.get(i).setIsCheck(false);
                    }
                    mJuliAdapter.notifyDataSetChanged();
                    bottomDialog.dismiss();
                    juli = juliList.get(position).getName().replace("km", "");
                    getShopByLang(juliList.get(position).getName().replace("km", ""));
                }
            }
        });
        mStargAdapter = new DialogAdapter2(R.layout.item_dialog, starList);
        mStargAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                for (int i = 0; i < starList.size(); i++) {
                    if (i == position) {
                        starList.get(position).setIsCheck(true);
                    } else {
                        starList.get(i).setIsCheck(false);
                    }
                    mStargAdapter.notifyDataSetChanged();
                    bottomDialog.dismiss();
                    pingfen = starList.get(position).getName().replace("星", "");
                    getShopByRemarkLevel(starList.get(position).getName().replace("星", ""));
                }
            }
        });

        mDialogAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                for (int i = 0; i < mDialogAdapterBeanList.size(); i++) {
                    if (i == position) {
                        mDialogAdapterBeanList.get(position).setIsCheck(true);
                    } else {
                        mDialogAdapterBeanList.get(i).setIsCheck(false);
                    }

                    mDialogAdapter.notifyDataSetChanged();
                    bottomDialog.dismiss();
                    getShopByRegion(mDialogAdapterBeanList.get(position).getName());
                    quyu = mDialogAdapterBeanList.get(position).getName();
                }
            }
        });

        //距离
        final TextView tv_juli = bottomDialog.findViewById(R.id.tv_juli);
        final TextView tv_quyu = bottomDialog.findViewById(R.id.tv_quyu);
        final TextView tv_pingfen = bottomDialog.findViewById(R.id.tv_pingfen);
        tv_juli.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onClick(View view) {
                num = 1;
                tv_juli.setTextColor(getResources().getColor(R.color.main_color));
                tv_quyu.setTextColor(getResources().getColor(R.color.background_content));
                tv_pingfen.setTextColor(getResources().getColor(R.color.background_content));
                tv_juli.setBackground(getDrawable(R.color.white));
                tv_quyu.setBackground(getDrawable(R.color.gray1));
                tv_pingfen.setBackground(getDrawable(R.color.gray1));
                //                mDialogAdapter = new DialogAdapter(R.layout.item_dialog, juliList);
                dialog_recyclerView.setAdapter(mJuliAdapter);

            }
        });
        //区域排序
        tv_quyu.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onClick(View view) {
                num = 3;
                tv_juli.setTextColor(getResources().getColor(R.color.background_content));
                tv_quyu.setTextColor(getResources().getColor(R.color.main_color));
                tv_pingfen.setTextColor(getResources().getColor(R.color.background_content));
                tv_juli.setBackground(getDrawable(R.color.gray1));
                tv_quyu.setBackground(getDrawable(R.color.white));
                tv_pingfen.setBackground(getDrawable(R.color.gray1));
                //                mDialogAdapter = new DialogAdapter(R.layout.item_dialog, mDialogAdapterBeanList);
                dialog_recyclerView.setAdapter(mDialogAdapter);

            }
        });
        //评分
        tv_pingfen.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onClick(View view) {
                num = 2;
                tv_juli.setTextColor(getResources().getColor(R.color.background_content));
                tv_quyu.setTextColor(getResources().getColor(R.color.background_content));
                tv_pingfen.setTextColor(getResources().getColor(R.color.main_color));
                tv_juli.setBackground(getDrawable(R.color.gray1));
                tv_quyu.setBackground(getDrawable(R.color.gray1));
                tv_pingfen.setBackground(getDrawable(R.color.white));
                dialog_recyclerView.setAdapter(mStargAdapter);
            }
        });

    }

    private void setJuliData() {
        DialogAdapterBean.DataBean mDataBean = new DialogAdapterBean.DataBean();
        mDataBean.setName("1km");
        mDataBean.setIsCheck(true);
        juliList.add(mDataBean);

        DialogAdapterBean.DataBean mDataBean1 = new DialogAdapterBean.DataBean();
        mDataBean1.setName("3km");
        mDataBean1.setIsCheck(false);
        juliList.add(mDataBean1);

        DialogAdapterBean.DataBean mDataBean2 = new DialogAdapterBean.DataBean();
        mDataBean2.setName("5km");
        mDataBean2.setIsCheck(false);
        juliList.add(mDataBean2);

        DialogAdapterBean.DataBean mDataBean3 = new DialogAdapterBean.DataBean();
        mDataBean3.setName("7km");
        mDataBean3.setIsCheck(false);
        juliList.add(mDataBean3);

        DialogAdapterBean.DataBean mDataBean4 = new DialogAdapterBean.DataBean();
        mDataBean4.setName("全城");
        mDataBean4.setIsCheck(false);
        juliList.add(mDataBean4);
    }

    private void setStarData() {
        DialogAdapterBean.DataBean mDataBean = new DialogAdapterBean.DataBean();
        mDataBean.setName("5星");
        mDataBean.setIsCheck(true);
        starList.add(mDataBean);

        DialogAdapterBean.DataBean mDataBean1 = new DialogAdapterBean.DataBean();
        mDataBean1.setName("4星");
        mDataBean1.setIsCheck(false);
        starList.add(mDataBean1);

        DialogAdapterBean.DataBean mDataBean2 = new DialogAdapterBean.DataBean();
        mDataBean2.setName("3星");
        mDataBean2.setIsCheck(false);
        starList.add(mDataBean2);

        DialogAdapterBean.DataBean mDataBean3 = new DialogAdapterBean.DataBean();
        mDataBean3.setName("2星");
        mDataBean3.setIsCheck(false);
        starList.add(mDataBean3);

        DialogAdapterBean.DataBean mDataBean4 = new DialogAdapterBean.DataBean();
        mDataBean4.setName("1星");
        mDataBean4.setIsCheck(false);
        starList.add(mDataBean4);
    }

    //根据区域查询店铺
    private void getShopByRegion(String str) {
        OkGo.<String>post(Config.s + "llc/shop/queryShopByRegion")
                .tag(this)
                .params("regionName", str)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        ShopListBean baseBean = gson.fromJson(response.body(), ShopListBean.class);
                        if (baseBean.isIsSuccess()) {
                            shopListBeanList.clear();
                            shopListBeanList.addAll(baseBean.getData());
                            if (shopListBeanList.size()<1){
                                ll_noshop.setVisibility(View.VISIBLE);
                            }else {
                                ll_noshop.setVisibility(View.GONE);
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }

    //根据距离查询店铺
    private void getShopByLang(String str) {
        OkGo.<String>post(Config.s + "llc/shop/queryShopByLang")
                .tag(this)
                .params("lang", str)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        ShopListBean baseBean = gson.fromJson(response.body(), ShopListBean.class);
                        if (baseBean.isIsSuccess()) {
                            shopListBeanList.clear();
                            shopListBeanList.addAll(baseBean.getData());
                            if (shopListBeanList.size()<1){
                                ll_noshop.setVisibility(View.VISIBLE);
                            }else {
                                ll_noshop.setVisibility(View.GONE);
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }

    //根据评分查询店铺
    private void getShopByRemarkLevel(String str) {
        OkGo.<String>post(Config.s + "llc/shop/queryShopByRemarkLevel")
                .tag(this)
                .params("level", str)
                .params("lat", Latitude)
                .params("lon", Longitude)
                .execute(new StringCallback() {
                    @Override
                    public void onSuccess(Response<String> response) {
                        Gson gson = new Gson();
                        ShopListBean baseBean = gson.fromJson(response.body(), ShopListBean.class);
                        if (baseBean.isIsSuccess()) {
                            shopListBeanList.clear();
                            shopListBeanList.addAll(baseBean.getData());
                            if (shopListBeanList.size()<1){
                                ll_noshop.setVisibility(View.VISIBLE);
                            }else {
                                ll_noshop.setVisibility(View.GONE);
                            }
                            adapter.notifyDataSetChanged();
                        } else {
                            RxToast.error(baseBean.getOutputMessage());
                        }
                    }
                });
    }
}
